package com.hspedu.generic.Homewrok;

import java.util.*;

/**
 * @author DL5O
 * @version 1.0
 */
public class Homework01 {
    public static void main(String[] args) {
        User ywl = new User(1, 21, "ywl");
        User sky = new User(2, 20, "sky");
        User zsj = new User(3, 19, "zsj");
        User wjq = new User(4, 18, "wjq");
        User py = new User(4, 20, "py");

        //sava方法的使用
        DAO<User> userDAO = new DAO<>();
        userDAO.save("1", ywl);
        userDAO.save("2", sky);
        userDAO.save("3", zsj);
        userDAO.save("4", wjq);

        System.out.println("====添加之后====");
        //list方法的使用
        List<User> list = userDAO.list();
        DAO.output(list);


        System.out.println("=====修改之后====");
        //update函数的使用
        userDAO.update("4", py);
        DAO.output(list);

        System.out.println("====1号ID用户的信息====");
        System.out.println(userDAO.get("1"));

        System.out.println("====删除之后====");
        userDAO.delete("1");
        list = userDAO.list();
        DAO.output(list);
    }

}


